<?php

declare(strict_types=1);

namespace app\api\controller;

use think\facade\Request;
use think\facade\Db;

class Index
{
    public function index()
    {
        return '您好！这是一个[api]示例应用';
    }

    /**
     * 获取用户信息
     */
    public function getUserInfo()
    {
        $openid = Request::header('openid');
        $user = Db::name('user')->where('wechat_openid', $openid)->find();
        $user['nickname'] = userTextDecode($user['nickname']);
        return jsonData(1, '查询成功', $user);
    }
}
